package STUDENT.TranMinhVu.OOPS.ArrayExercises;

public class Models {
	public double AverageOfElement(double[] dArray) {
		double dSum = 0;
	    for (int i = 0; i < dArray.length; i++) {
	     	dSum += dArray[i];
	    }
	    return dSum/dArray.length;
	}
	
	public int NumbersAboveAverage(double[] dArray) {
		int count = 0;
		for (int i = 0; i <dArray.length; i++) {
			if (dArray[i]>=AverageOfElement(dArray))
				count++;
		}
		return count;
	}
	
	public int NumberUnderAverage(double[] dArray) {
		int count = 0;
		for (int i = 0; i< dArray.length ; i++) {
			if (dArray[i]<AverageOfElement(dArray))
				count++;
		}
		return count;
	}
}